//
//  ParticularModel.m
//  bbqpitbooking
//
//  Created by Yin Ni Tun on 5/29/11.
//  Copyright 2011 iss. All rights reserved.
//

#import "ParticularModel.h"


@implementation ParticularModel
-(BOOL) checkParticulars:(NSString *) txtName andNRIC:(NSString *) txtNRIC andContact:(NSString *) txtContact andEmail :(NSString *)txtEmail{

	if ([txtName length] == 0) {
		return FALSE;
	}else if ([txtNRIC length] == 0) {
		return FALSE;
	}else if ([txtContact length] == 0) {
		return FALSE;
	}else if ([txtEmail length] == 0) {
		return FALSE;
	}else {
		return TRUE;
	}
}
- (BOOL) validateEmail: (NSString *) custEmail {
    NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; 
    NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; 
	
    return [emailTest evaluateWithObject:custEmail];
}
-(BOOL) validateNRIC :(NSString *) custNRIC{
	//NSString *firstLetter = [custNRIC substringToIndex:1]; 
	//NSString *lastLetter = [custNRIC substringToIndex:-1];
	
	if ([custNRIC length] != 9) {
		return FALSE;
	}else {
		return TRUE;
	}

}	
- (BOOL) cardDetails:(NSString *) txtCardName andCardNo:(NSString *) txtCardNo andPinNo:(NSString  *) txtPinNo andAmount :(NSString *) txtAmount {
	     

		if ([txtCardName length] == 0) {
			return FALSE;
		}else if ([txtCardNo length] == 0) {
			return FALSE;
		}else if ([txtPinNo length] == 0) {
			return FALSE;
		}else if ([txtAmount length] == 0) {
			return FALSE;
		}else {
			return TRUE;
		}
	
}

@end
